
package org.cuatrovientos.dice;

import java.util.Random;

/**
 * @author teodor_mivovan
 *
 */
public class Dice {
	/**
	 * This attribute represents the sides of the dice.
	 */
	private int sides;
	/**
	 * This attribute decides if the numbers admit Zero.
	 */
	private boolean admitZero = true;
	/**
	 * Default constructor.
	 */
	public Dice(){
		sides = 6;
	}
	/**
	 * Constructor where you can decide the number of sides.
	 * @param faces
	 */
	public Dice(int sides){
		this.sides = sides;
	}
	/**
	 * Constructor where you can decide the number of sides and if admits Zero.
	 * @param faces
	 * @param admitZero
	 */
	public Dice(int sides,boolean admitZero){
		this.sides = sides;
		this.admitZero = admitZero;
	}
	/**
	 * Constructor that returns a integer with the random result of the Dice.
	 * @return randomNumber
	 */
	public int roll (){
		int randomNumber=0;
		Random random = new Random();
		
		if(admitZero=true){
		randomNumber=random.nextInt(sides); 
		}else{
		randomNumber=random.nextInt(sides)+1;	
		}
		
		
		return randomNumber;
	}
	

}
